import { getCookie, setCookie } from "@/utils";
import { createSlice } from "@reduxjs/toolkit";

export const CollectNumData = createSlice({
  name: 'collectNum',
  initialState: {
    value: getCookie('collectNum') || 0
  },
  reducers: {
    saveCollectNum: (state, action) => {
       state.value = action.payload      
       setCookie('collectNum', action.payload) 
    }
  }
})

export const { saveCollectNum } = CollectNumData.actions
export default CollectNumData.reducer 